package com.qky.dao.utilDao;

import javax.annotation.Resource;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

/**
 * 自动注入sessionFactory,提供返回currentSession的方法；
 * @author kaiyuan
 *
 */
@Repository
public class CurrentSessionDao{
	@Resource
	SessionFactory sessionFactory;
	
	/**
	 * 返回currentSession
	 * @return
	 */
	protected final Session currentSession(){
		return sessionFactory.getCurrentSession();
	}
}
